﻿Public Class Class1
    Public Structure locations_per_sec
        Dim time As Double
        Dim XLoc As Double
        Dim YLoc As Double
    End Structure
    Private a As Double
    Private Vp As Double
    Private Vh As Double
    Private Vv As Double
    Private H As Double

    Public Property angle() As Double
        Get
            Return a
        End Get
        Set(ByVal value As Double)
            If -1 < value And value < 91 Then
                a = value
            Else : a = 45
            End If

        End Set
    End Property

    Public Property speed() As Double
        Get
            Return Vp
        End Get
        Set(ByVal value As Double)
            Vp = value
        End Set
    End Property
    Public Function location_times(Optional ByVal Height As Double = 5.0) As List(Of locations_per_sec)
        Dim z As New List(Of locations_per_sec)(0)
        Dim time As Double = 0
        Dim XLoc As Double = 0
        Dim YLoc As Double = 0
        H = Height
        Dim sec As New locations_per_sec
        Vh = Vp * Math.Cos(angle * Math.PI / 180)
        Vv = Vp * Math.Sin(angle * Math.PI / 180)

        Do Until YLoc < 0
            time += 0.01
            XLoc = Vh * time
            YLoc = H + Vv * time - 0.5 * 32 * time ^ 2
            sec.time = time
            sec.XLoc = XLoc
            sec.YLoc = YLoc
            z.Add(sec)
        Loop

        Return z
    End Function
End Class
